<div class="layui-form-item">
    <label for="" class="layui-form-label">父级</label>
    <div class="layui-input-inline">
        <select name="parent_id" lay-verify="requried">
            <option value="0">顶级</option>
            {foreach $permissions as $k1=>$p1}
                <option value="{$p1.id}" {if isset($model) && $model->parent_id==$p1['id']} selected {/if} >{$p1.name}</option>
                {if isset($p1['child']) && !empty($p1['child']) }
                    {foreach $p1['child'] as $k2=>$p2}
                        <option value="{$p2.id}" {if isset($model) && $model->parent_id==$p2['id']} selected {/if} >&nbsp;&nbsp;&nbsp;┗━━{$p2.name}</option>
                        {if isset($p2['child']) && !empty($p2['child']) }
                            {foreach $p2['child'] as $k3=>$p3}
                                <option value="{$p3.id}" {if isset($model) && $model->parent_id==$p3['id']} selected {/if} >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;┗━━{$p3.name}</option>
                            {/foreach}
                        {/if}
                    {/foreach}
                {/if}
            {/foreach}
        </select>
    </div>
</div>
<div class="layui-form-item">
    <label for="" class="layui-form-label">名称</label>
    <div class="layui-input-inline">
        <input type="text" maxlength="16" name="name" value="{$model->name??''}" lay-verify="required" placeholder="请输入名称" class="layui-input" >
    </div>
</div>

<div class="layui-form-item">
    <label for="" class="layui-form-label">描述</label>
    <div class="layui-input-inline">
        <textarea name="description" class="layui-textarea">{$model->description??''}</textarea>
    </div>
</div>
<div class="layui-form-item">
    <label for="" class="layui-form-label">类型</label>
    <div class="layui-input-inline">
        <input type="radio" name="type" value="1" title="菜单" checked>
        <input type="radio" name="type" value="2" title="按钮" >
    </div>
</div>
<div class="layui-form-item">
    <label for="" class="layui-form-label">路由</label>
    <div class="layui-input-inline">
        <input type="text" name="url" value="{$model->url??''}" lay-verify="required" placeholder="请输入路由名称" class="layui-input" >
    </div>
    <div class="layui-form-mid layui-word-aux">
        菜单格式为module/controller/action
    </div>
</div>
<div class="layui-form-item">
    <label for="" class="layui-form-label">图标</label>
    <div class="layui-input-inline">
        <input class="layui-input" type="hidden" name="icon" >
    </div>
    <div class="layui-form-mid layui-word-aux" id="icon_box">
        <i class="layui-icon {$model->icon??''}"></i>
    </div>
    <div class="layui-form-mid layui-word-aux">
        <button type="button" class="layui-btn layui-btn-xs" onclick="showIconsBox()">选择图标</button>
    </div>
</div>
<div class="layui-form-item">
    <label for="" class="layui-form-label">排序</label>
    <div class="layui-input-inline">
        <input type="number" name="sort" value="{$model->sort??10}" lay-verify="required" placeholder="排序权重" class="layui-input" >
    </div>
    <div class="layui-form-mid layui-word-aux">
        值越小越靠前
    </div>
</div>
<div class="layui-form-item">
    <div class="layui-input-block">
        <button type="submit" class="layui-btn layui-btn-sm" lay-submit="" lay-filter="formDemo">确 认</button>
        <a  class="layui-btn layui-btn-sm" href="{:url('index')}" >返 回</a>
    </div>
</div>